#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    size_t n = 0;
    cin >> n;
    vector<int> v;
    v.reserve(n * 3);
    int tmp = 0;
    for (size_t i = 0; i < v.capacity(); ++i)
    {
        cin >> tmp;
        v.push_back(tmp);
    }
    sort(v.rbegin(), v.rend());
    long long sum = 0;
    for (size_t i = 1; i < 3 * n; i += 1)
    {
        sum += v[i];
    }
    cout << sum;
    return 0;
}